package it.ActivityDemo;

import android.app.Activity; 
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class ActivityDemoActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Log.i("ActivityDemo", "Richiamato onCreate() con bundle " + savedInstanceState);
Button button = new Button(this);
button.setText("Lancia SubActivity");
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { startSubActivity(); }});
setContentView(button); }
private void startSubActivity() {
Intent intent = new Intent(this, SubActivity.class);
startActivity(intent);
}

@Override
protected void onRestart()
{
super.onRestart();
Log.i("ActivityDemo", "Richiamato onRestart()"); }
@Override
protected void onStart() {
super.onStart();
Log.i("ActivityDemo", "Richiamato onStart()"); }
@Override
protected void onResume() {
super.onResume();
Log.i("ActivityDemo", "Richiamato onResume()"); }
@Override
protected void onPause() {
super.onPause();
Log.i("ActivityDemo", "Richiamato onPause()"); }
@Override
protected void onStop() {
super.onStop();
Log.i("ActivityDemo", "Richiamato onStop()"); }
@Override
protected void onDestroy() {
super.onDestroy();
Log.i("ActivityDemo", "Richiamato onDestroy()");
}
}